<template>
<div class="updateUseInfo_wrap">
  <el-form  label-position="left" label-width="130px" :inline="false">
    <el-form-item label="用户头像：">
      <singleUpload :params="uploadAvatar" :uploadSuccess="avatarSuccess" :pictureUrl="form.headfilepath" :width="145" :height="145"></singleUpload>
    </el-form-item>

    <el-form-item label="用户昵称：">
      <el-input v-model="form.username"></el-input>
    </el-form-item>
    <el-form-item label="用户类型：">
      <el-input v-model="form.usertype"></el-input>
    </el-form-item>
    <el-form-item label="在职状态：">
      <el-input v-model="form.workstate"></el-input>
    </el-form-item>
    <!-- <el-form-item label="公司证件号：">
      <el-input ></el-input>
    </el-form-item> -->
    <el-form-item label="性别：">
      <el-radio v-model="form.sex" label="男">男</el-radio>
      <el-radio v-model="form.sex" label="女">女</el-radio>
    </el-form-item>
    <el-form-item label="是否管理员：">
      <el-radio v-model="form.ismanager" :label="1">是</el-radio>
      <el-radio v-model="form.ismanager" :label="0">否</el-radio>
    </el-form-item>
    <el-form-item label="是否启用：">
      <el-radio v-model="form.disenable" :label="0">启用</el-radio>
      <el-radio v-model="form.disenable" :label="1">禁用</el-radio>
    </el-form-item>
    <el-form-item label="入职日期：">
      <el-date-picker
        v-model="form.entrydate"
        type="date"
        placeholder="选择日期"
        format="yyyy:MM:dd"
        value-format="yyyy-MM-dd HH:mm:ss">
      </el-date-picker>
    </el-form-item>
    <el-form-item label="优先级排序">
        <el-input v-model="form.orderindex"></el-input>
    </el-form-item>
    <el-form-item label="用户工号">
        <el-input v-model="form.userid"></el-input>
    </el-form-item>
    <el-form-item>
        <el-button type="primary" @click="save">确认</el-button>
    </el-form-item>
  </el-form>
</div>
</template>
<script>
import singleUpload from '@/components/img-upload/singleUpload'
import {IMGSERVER}     from '@/common/js/constant'
export default {
  components:{
    singleUpload
  },
  data(){
    return{
      imgServerUrl:IMGSERVER,
      uploadAvatar:{
        name:"avatarFile"
      },
      form:{
        companyid:this.$store.getters.companyId,
        departmentid:this.$store.getters.departmentId,
        disenable:0,
        entrydate:this.$store.getters.entryDate,
        sex:this.$store.getters.sex,
        ismanager:this.$store.getters.ismanager,
        orderindex:100,
        registerflag:this.$store.getters.registerFlag,
        headfilepath:this.$store.getters.headfilePath,
        userid:this.$store.getters.userUid,
        id:this.$store.getters.Id,
        username:this.$store.getters.userName,
        workstate:this.$store.getters.workState,
        usertype:this.$store.getters.userType
      }
    }
  },
  methods:{
    avatarSuccess(val){
      this.form.headfilepath = val;
    },
    save(){
       this.$post("/userInfo/updateUserInfo",this.form,data => {
         this.$message({
            message: '修改成功，重新启动系统生效！',
            type: 'success'
          });
         },error => {
           this.$message.error(data);
       });
    }
  },
  created(){
    console.log(this.$store.getters.headfilePath);
    // alert(this.form.ismanager);
    // alert(this.$store.getters.ismanager)
  }
}
</script>
<style>
</style>
